@extends('module::BlogThemeLightA.View.pc.frameCustom')

@section('pageTitle'){{$record['title']}} | {{modstart_config('siteName')}}@endsection
@section('pageKeywords'){{$record['seoKeywords']?$record['seoKeywords']:$record['title']}}@endsection
@section('pageDescription'){{$record['seoDescription']?$record['seoDescription']:$record['summary']}}@endsection

@section('bodyContent')

    <script>window.__msCDN = "{{\ModStart\Core\Assets\AssetsUtil::cdn()}}";window.__msRoot = "{{modstart_web_url()}}";</script>
    <script src="@asset('asset/vendor/jquery.js')"></script>
    <script src="@asset('asset/common/base.js')"></script>
    <script src="@asset('asset/layui/layui.js')"></script>
    <link rel="stylesheet" href="@asset('asset/theme/default/variable.css')">
    <link rel="stylesheet" href="@asset('asset/theme/default/base.css')">
    <link rel="stylesheet" href="@asset('asset/layui/css/layui.css')">

    <div class="article-wrap">
        <div class="container-xxl">
            <div class="row" style="padding-top:70px !important;">
                <div class="col-lg-8">
                    <div class="article">
                        <div class="article-position">
                            <span><i></i></span>
                            <ul>
                                <li><a href="{{modstart_web_url('')}}">网站首页</a></li>
                                @if($record['_category'])
                                    <li>
                                        <a href="{{\Module\Blog\Util\UrlUtil::category($record['_category'])}}"
                                           data-toggle="tooltip" title="" data-original-title="点进进入原文链接">
                                            {{$record['_category']['title']}}
                                        </a>
                                    </li>
                                @endif
                                <li>{{$record['title']}}</li>
                            </ul>
                        </div>
                        <div class="article-title">
                            <h2>{{$record['title']}}</h2>
                            <div class="data">
                                <span><i></i>{{ $record['_date'] }}</span>
                                <span><i></i>{{$record['clickCount']?:0}}</span>
                                <span><i></i>{{$record['commentCount']?:0}}</span>
                            </div>
                        </div>
                        <div class="article-body" id="article-lightbox">
                            {!! $record['content'] !!}
                        </div>
                        @if(0)
                            <div class="article-tool">
                                <a href="JavaScript:;"><i></i>点赞 (<span id="rss_zan_num">24</span>)</a>
                                <a href="JavaScript:;" data-bs-toggle="modal" data-bs-target="#dashang"><i></i>充电</a>
                                <a href="JavaScript:;" data-bs-toggle="modal" data-bs-target="#wx-share"><i></i>分享</a>
                            </div>
                        @endif
                        <div class="article-tag">
                            <ul>
                                @foreach($record['tag'] as $t)
                                    <li>
                                        <a href="{{\Module\Blog\Util\UrlUtil::tag($t)}}">{{$t}}</a>
                                    </li>
                                @endforeach
                            </ul>
                        </div>
                    </div>

                    <div class="text-list">
                        <div class="row">
                            <div class="col-12 col-xl-6">
                                <div class="text-list-box">
                                    <h3>分类推荐</h3>
                                    <ul>
                                        @foreach(MBlog::paginateBlog($record['categoryId'],1,5)['records'] as $r)
                                            <li>
                                                <i class="iconfont"></i>
                                                <a href="{{$r['_url']}}">{{$r['title']}}</a>
                                            </li>
                                        @endforeach
                                    </ul>
                                </div>
                            </div>
                            <div class="col-12 col-xl-6">
                                <div class="text-list-box">
                                    <h3>相关内容</h3>
                                    <ul>
                                        @foreach(MBlog::hottestBlog(5) as $r)
                                            <li>
                                                <i class="iconfont"></i>
                                                <a href="{{$r['_url']}}">{{$r['title']}}</a>
                                            </li>
                                        @endforeach
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>

                    @if(modstart_config('Blog_CommentEnable',false))
                        <div class="comments">
                            <div class="comment-title">
                                <h4>
                                    <i class="iconfont"></i>评论一下吧
                                </h4>
                                <div id="reply-sptitle"></div>
                                @if(0)
                                <small>
                                    <a rel="nofollow" id="cancel-comment-reply-link" style="display: none"
                                       href="javascript:">取消回复</a>
                                </small>
                                {{--<span>评论守则</span>--}}
                                @endif
                            </div>


                            <div class="comments-form">
                                <form method="post"
                                      data-ajax-form
                                      action="{{modstart_api_url('blog/comment/add')}}">
                                    <input type="hidden" name="blogId" value="{{$record['id']}}" />
                                    <div class="row">
                                        <div class="col-sm-12">
                                            <div class="input-group">
                                            <textarea class="form-control"
                                                      name="content" id="content"
                                                      rows="5"></textarea>
                                            </div>
                                        </div>
                                        <input type="hidden" name="gid" value="10">
                                        <div class="col-lg-4 pr-0">
                                            <div class="input-group">
                                                <span class="input-group-text" id="username"><i
                                                        class="iconfont"></i>昵称*</span>
                                                <input type="text" value="" name="username" class="form-control"
                                                       placeholder="昵称*" aria-label="username" aria-describedby="username"
                                                       required>
                                            </div>
                                        </div>
                                        <div class="col-lg-4 pr-0">
                                            <div class="input-group">
                                                <span class="input-group-text" id="email"><i
                                                        class="iconfont"></i>邮箱*</span>
                                                <input type="text" value="" name="email" class="form-control"
                                                       placeholder="邮箱*" aria-label="email" aria-describedby="email"
                                                       required>
                                            </div>
                                        </div>
                                        <div class="col-lg-4">
                                            <div class="input-group">
                                            <span class="input-group-text" id="url"><i
                                                    class="iconfont"></i>个人主页*</span>
                                                <input type="text" value="" name="url" class="form-control"
                                                       placeholder="个人主页*" aria-label="url" aria-describedby="url"
                                                       required>
                                            </div>
                                        </div>
                                        <div class="col-md-8 pr-0">
                                            <div class="row">
                                                <style>
                                                    .pb-widget-captcha{}
                                                    .pb-widget-captcha input, .pb-widget-captcha img{border: 1px solid #EEE; height: 36px !important; padding: 0 5px; border-radius: 5px;}
                                                    .pb-widget-captcha .image{width:180px !important;}
                                                </style>
                                                <div class="col-6">
                                                    {!! \Module\Vendor\Provider\Captcha\CaptchaProvider::get(modstart_config('Blog_BlogCaptchaProvider','default'))->render() !!}
                                                </div>
                                                <div class="col-6">
                                                    <button type="submit" class="comments-btn">发表评论</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>

                            <div class="comments-list">

                                @foreach($comments as $comment)
                                    <div class="item" id="{{$comment['id']}}">
                                        <div class="tx">
                                            <img src="{{$comment['_avatar']}}"
                                                 alt="{{$comment['username']?$comment['username']:'匿名用户'}}"></div>
                                        <div class="data">
                                            <h4>{{$comment['username']?$comment['username']:'匿名用户'}}</h4>
                                            <span>发表于：{{$comment['created_at']}}</span>
                                        </div>
                                        <div class="cont">
                                            {!! $comment['content'] !!}
                                        </div>
                                        @if(0)
                                        <div class="tool">
                                            <a href="JavaScript:;">
                                                <i class="iconfont"></i>
                                                点赞 (<span id="count">3</span>)
                                            </a>
                                            <a href="#reply-sptitle">
                                                <i class="iconfont"></i>
                                                回复
                                            </a>
                                        </div>
                                        @endif
                                    </div>
                                @endforeach

                            </div>

                            <div style="padding-bottom:10px;">
                                <nav style="font:initial;">
                                    {!! \ModStart\Core\Util\PageHtmlUtil::render($commentTotal, $commentPageSize, $commentPage,
                                            '?' . \ModStart\Core\Input\Request::mergeQueries(['page' => ['{page}']]), [
                                        'warp' => '<ul class="pagination justify-content-center">%s%</ul>',
                                        'more' => '<li class="page-item"><a class="page-link" href="javascript:;">...</a></li>',
                                        'prev' => '<li class="page-item"><a class="page-link" href="%s%">上一页</a></li>',
                                        'prevDisabled' => '<li class="page-item disabled"><span class="page-link">上一页</span></li>',
                                        'next' => '<li class="page-item"><a class="page-link" href="%s%">下一页</a></li>',
                                        'nextDisabled' => '<li class="page-item disabled"><span class="page-link">下一页</span></li>',
                                        'current' => '<li class="page-item"><a class="page-link" href="javascript:;">%p%</a></li>',
                                        'item' => '<li class="page-item"><a class="page-link" href="%s%">%p%</a></li>',
                                    ]) !!}
                                </nav>
                            </div>

                        </div>
                    @endif

                </div>
                @include('module::BlogThemeLightA.View.pc.inc.pageRightPanel')
            </div>
        </div>
    </div>
@endsection
